﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using AvalonDock.Layout;

namespace SPCAM.Views
{
    /// <summary>
    /// MainWindowDocking.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindowDocking : UserControl
    {
        public MainWindowDocking()
        {
            InitializeComponent();
           // dock_cam.IsActive = true;
        }
        public void ActivateToolAnchorable(string layoutContentId)
        {
            var layoutModel = DockingManager.Layout.Descendents().OfType<LayoutAnchorable>().FirstOrDefault(anchorable => anchorable.ContentId == layoutContentId);
            var layoutItemModel = layoutModel?.Root?.Manager?.GetLayoutItemFromModel(layoutModel);
            if (layoutItemModel == null)
                return;

            if (layoutModel.IsHidden)
                layoutModel.Show();
            else if (layoutModel.IsVisible)
                layoutModel.IsActive = true;
            else
                layoutModel.AddToLayout(DockingManager, AnchorableShowStrategy.Right | AnchorableShowStrategy.Most);
        }
        public void ActioveCamTab()
        {

        }
    }
}
